package jp.sourceforge.akjrcp.text_douga.wizards.importimg;

import jp.sourceforge.akjrcp.text_douga.rcp.TextDougaView;

import org.eclipse.jface.wizard.Wizard;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.ui.PlatformUI;

public class ImportImageWizard extends Wizard{

	
	@Override
	public boolean performFinish() {
		TextDougaView view=(TextDougaView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(TextDougaView.ID);
		
		//change mode
		
		view.setExportType(TextDougaView.AVI);
		view.setExportMode(TextDougaView.MODE_MUX);
		String text="";		
		if(page1.getSize().length()>0){
			text+="#export_size="+page1.getSize();
		}else{
			text+="#export_size="+"640x480";
		}
		text+="\n";
		if(page1.getFps().length()>0){
			text+="#export_fps="+page1.getFps();
		}else{
			text+="#export_fps="+"29.97";
		}
		text+="\n";

		text+="#";
		if(!page1.getDuration().equals("")){
			text+="duration="+page1.getDuration()+",";
		}
		if(!page1.getWait().equals("")){
			text+="wait="+page1.getWait()+",";
		}
		if(!page1.getFadein().equals("")){
			text+="fadein="+page1.getFadein()+",";
		}
		if(!page1.getFadeout().equals("")){
			text+="fadeout="+page1.getFadeout()+",";
		}
		if(!page1.getAlign().equals("")){
			text+="align="+page1.getAlign()+",";
		}
		if(!page1.getValign().equals("")){
			text+="valign="+page1.getValign()+",";
		}
		if(!page1.getLoop().equals("")){
			text+="loop="+page1.getLoop()+",";
		}
		if(page1.getSize().length()>0){
			String wh[]=page1.getSize().split("x");
			if(wh.length>1){
				text+="width="+wh[0]+",";
				text+="height="+wh[1]+",";
			}
		}else{
			text+="width=640,height=480";
		}
		
		text+=";\n";
		text+=page1.getPath()+"\n";
		view.setText(text);
		return true;
	}
	ImageInputPage page1;

	public void addPages()
    {
		page1=new ImageInputPage("endroll.inputText");
		addPage(page1);
		
		//oneday support selectable
		//page2=new SizeAndRate("endroll.inputText");
		//addPage(page2);
    }
}
